package com.li.controller;

import com.li.pojo.dto.salesStatisticDTO;
import com.li.pojo.po.IndexBase;
import com.li.pojo.po.IndexTo;
import com.li.pojo.po.IndexToday;
import com.li.pojo.po.Result;
import com.li.pojo.vo.salesStatisticVO;
import com.li.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/index")
@Slf4j
public class IndexController {

    @Autowired
    private ReportService reportService;


    @GetMapping
    public Result index(String beginCreateTime,String endCreateTime){
        return new Result(200,"操作成功",reportService.index(beginCreateTime,endCreateTime));
    }

    @GetMapping("/salesStatistic")
    public Result salesStatistic( salesStatisticDTO salesStatisticDTO){
        log.info("salesStatisticDTO:{}",salesStatisticDTO);
        List<salesStatisticVO> salesStatisticVOS = reportService.salesStatistic(salesStatisticDTO);
        log.info("线索表报：{}",salesStatisticVOS);
        return new Result(200 ,"操作成功",salesStatisticVOS);
    }
    @GetMapping("/businessChangeStatistics")
    public Result businessChange (salesStatisticDTO salesStatisticDTO){

        List<salesStatisticVO> businessChange = reportService.businessChange(salesStatisticDTO);
        log.info("线索表报：{}",businessChange);
        return new Result(200,"操作成功",businessChange);
    }

}